<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Gets line from stream resource up to a given delimiter</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.stream-get-filters.html">stream_get_filters</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.stream-get-meta-data.html">stream_get_meta_data</a></div>
 <div class="up"><a href="ref.stream.html">Stream 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.stream-get-line" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">stream_get_line</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">stream_get_line</span> &mdash; <span class="dc-title">Gets line from stream resource up to a given delimiter</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.stream-get-line-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>stream_get_line</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$handle</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$ending</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Gets a line from the given handle.
  </p>
  <p class="para">
   Reading ends when <em><code class="parameter">length</code></em> bytes have been read, when
   the string specified by <em><code class="parameter">ending</code></em> is found (which is
   <em class="emphasis">not</em> included in the return value), or on <acronym title="End Of File">EOF</acronym>
   (whichever comes first).
  </p>
  <p class="para">
   This function is nearly identical to <span class="function"><a href="function.fgets.html" class="function">fgets()</a></span> except in
   that it allows end of line delimiters other than the standard \n, \r, and
   \r\n, and does <em class="emphasis">not</em> return the delimiter itself.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.stream-get-line-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">handle</code></em></dt>

     <dd>

      <p class="para">
       A valid file handle.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">length</code></em></dt>

     <dd>

      <p class="para">
       The number of bytes to read from the handle.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">ending</code></em></dt>

     <dd>

      <p class="para">
       An optional string delimiter.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.stream-get-line-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a string of up to <em><code class="parameter">length</code></em> bytes read from the file
   pointed to by <em><code class="parameter">handle</code></em>.
  </p>
  <p class="para">
   If an error occurs, returns <strong><code>FALSE</code></strong>.
  </p>
 </div>

  
 <div class="refsect1 seealso" id="refsect1-function.stream-get-line-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="function.fread.html" class="function" rel="rdfs-seeAlso">fread()</a> - 读取文件（可安全用于二进制文件）</span></li>
   <li class="member"><span class="function"><a href="function.fgets.html" class="function" rel="rdfs-seeAlso">fgets()</a> - 从文件指针中读取一行</span></li>
   <li class="member"><span class="function"><a href="function.fgetc.html" class="function" rel="rdfs-seeAlso">fgetc()</a> - 从文件指针中读取字符</span></li>
  </ul>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.stream-get-filters.html">stream_get_filters</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.stream-get-meta-data.html">stream_get_meta_data</a></div>
 <div class="up"><a href="ref.stream.html">Stream 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
